﻿<h3 class="important-tittle">Events</h3>

<div class="text-center">
    <img class="spaced banner-image" src="/App/Examples/v1/Events/Images/eventsgif.gif" />
</div>

<div class="doc-alert">
    To keep this example always up to date it is directly pulled from the Github repository, the
    repo for simplicity uses the <i>UserControl</i> class to wrap every example, but you can use any
    container for your plots.
</div>

<h3>Events and commands</h3>

<p>
    Any event in the library has also a property of Type <i class="text-muted">ICommand</i> this means you can also bind an action
    to the event following MV* patterns.
</p>

<table class="table table-striped">
    <thead>
        <tr>
            <th>Name</th>
            <th>Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Chart.UpdaterTick or Chart.UpdaterTickCommand</td>
            <td>Fired every time The chart updates</td>
        </tr>
        <tr>
            <td>Chart.DataClick or Chart.DataClickCommand</td>
            <td>Occurs every time the users click over a point in a chart</td>
        </tr>
        <tr>
            <td>Chart.DataHover or Chart.DataHoverCommand</td>
            <td>Happens every time the users hovers over a point in a chart</td>
        </tr>
        <tr>
            <td>Axis.RangeChanged or Axis.RangeChangedCommand</td>
            <td>Occurs every time the range of an axis changes, including when a user uses features such as zooming and panning</td>
        </tr>
    </tbody>
</table>

<h4>XAML</h4>

<pre class="prettyprint" url="https://raw.githubusercontent.com/beto-rodriguez/Live-Charts/master/Examples/Uwp/CartesianChart/Events/EventsExample.xaml"></pre>

<h4>Code Behind</h4>

<pre class="prettyprint" url="https://raw.githubusercontent.com/beto-rodriguez/Live-Charts/master/Examples/Uwp/CartesianChart/Events/EventsExample.xaml.cs"></pre>

<p class="text-muted">ViewModel.cs</p>

<pre class="prettyprint" url="https://raw.githubusercontent.com/beto-rodriguez/Live-Charts/master/Examples/Uwp/CartesianChart/Events/ViewModel.cs"></pre>

<p class="text-muted">MyCommand.cs</p>

<pre class="prettyprint" url="https://raw.githubusercontent.com/beto-rodriguez/Live-Charts/master/Examples/Uwp/CartesianChart/Events/ChartPointCommandHandler.cs"></pre>
